from sklearn.ensemble import RandomForestClassifier
import numpy as np

from ENF_deepLearning.utils.parent.Base import Base


class RF_Classifier(Base):
    def random_forest(self, x_train, x_test, y_train, y_test):
        RF = RandomForestClassifier(n_estimators=200, max_depth=8)
        RF.fit(x_train, y_train)
        res = RF.predict(x_test)
        a = np.sum(res == y_test)
        print(res, y_test, a / y_test.shape[0])
        self.save_pred_true(res.tolist(), y_test.tolist())